package game.commands 
{
	import core.Command;
	import game.Game;
	import game.map.UnitTypes;
	import game.Player;
	import game.unitmanager.UnitsManager;
	/**
	 * ...
	 * @author rnk
	 */
	public class StartGameCommand extends Command
	{
		
		
		public function StartGameCommand(papa:Game) 
		{
			this.papa = papa;
		}
		
		override public function Execute():void 
		{
			//test code
			
			papa.players = [
				new Player(1, "Герцог Анжуйский", 0xFF0000),
				new Player(2, "Сир Персиваль", 0x0080FF),
				new Player(3, "Барон Годфрид", 0xFFFFFF)
			];
			
			var unitsManager:UnitsManager = papa.unitsManager;
			unitsManager.AddUnit("Karhold", UnitTypes.FOOTMAN, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.FOOTMAN, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.FOOTMAN, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.KNIGHT, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.KNIGHT, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.ARCHER, papa.players[0].uid);
			unitsManager.AddUnit("Karhold", UnitTypes.ARCHER, papa.players[0].uid);
			
			unitsManager.AddUnit("Hightower", UnitTypes.ARCHER, papa.players[0].uid);
			
			unitsManager.AddUnit("Midtower", UnitTypes.FOOTMAN, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.FOOTMAN, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.FOOTMAN, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.KNIGHT, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.ARCHER, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.LANDSKNEHT, papa.players[1].uid);
			unitsManager.AddUnit("Midtower", UnitTypes.LANDSKNEHT, papa.players[1].uid);
			
			unitsManager.AddUnit("Farmland", UnitTypes.KNIGHT, papa.players[1].uid);
			
			unitsManager.AddUnit("StormCastle", UnitTypes.FOOTMAN, papa.players[2].uid);
			unitsManager.AddUnit("StormCastle", UnitTypes.FOOTMAN, papa.players[2].uid);
			unitsManager.AddUnit("StormCastle", UnitTypes.FOOTMAN, papa.players[2].uid);
			unitsManager.AddUnit("StormCastle", UnitTypes.ARCHER, papa.players[2].uid);
			unitsManager.AddUnit("StormCastle", UnitTypes.ARCHER, papa.players[2].uid);
			
			unitsManager.AddUnit("Grasslands", UnitTypes.LANDSKNEHT, papa.players[2].uid);
			unitsManager.AddUnit("Grasslands", UnitTypes.LANDSKNEHT, papa.players[2].uid);
			unitsManager.AddUnit("Grasslands", UnitTypes.LANDSKNEHT, papa.players[2].uid);
			unitsManager.AddUnit("Grasslands", UnitTypes.LANDSKNEHT, papa.players[2].uid);
			
			unitsManager.AddUnit("Fartower", UnitTypes.FOOTMAN, papa.players[2].uid);
			
			
			
			//start phase
			papa.NextPhase();
			

		}
	}

}